home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8700 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  39 lines

  1. Path: news.massey.ac.nz!sysadmin    
  2. From: Matthew.Hook.1@massey.ac.nz
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Why doesn't this work?
  5. Date: Wed, 06 Mar 1996 11:46:56 +1300
  6. Organization: Massey University, Palmerston North, New Zealand
  7. Message-ID: <313CC460.6279@uni.massey.ac.nz>
  8. References: <1996Mar4.161412.137442@forest>
  9. NNTP-Posting-Host: smis-tararua.massey.ac.nz
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.5 sun4d)
  14.  
  15. ebromber@forest.drew.edu wrote:
  16.  
  17. #include bla bla bla???????
  18.  
  19. > main();
  20. --snip--
  21.                pass[count]=c;
  22. >                 putch('*');
  23. >         }
  24. >         if (count!=4) { printf("\nWRONG PASSWORD\n"); main();}
  25. >         error=0;
  26. >         for (i=0; i<4; i++)
  27. >                 if (real[i]=pass[i]) error++;
  28. here is you problem         ***
  29. look closely now!!
  30. >         if (error>0) {printf("\nWRONG PASSWORD\n"); main();}
  31. > }
  32.  
  33.  
  34. By the way this is quite a sloppy piece of code (actually it sux)
  35. but I'll let you off being an obvious first timer and all.
  36. I personally would use strcmp() for the comparison and not bothered
  37. storing the actual password. i.e if strcmp(pass, "jerk") dothis; from
  38. memory.
  39.